#pragma once

#include <string>
#include <unordered_map>

#define ERROR_SUCCESS 0
#define ERROR_PARAMETER_WRONG 1001
#define ERROR_INTERNAL_WRONG 1002
#define ERROR_DATABASE_WRONG 1003
#define ERROR_TSHARK_WRONG 1004
#define ERROR_STATUS_WRONG 1005
#define ERROR_FILE_TOOLARGE 1006
#define ERROR_FILE_NOTFOUND 1007
#define ERROR_FILE_SAVE_FAILED 1008

// note: 错误处理
namespace Tshark
{
    class TsharkError
    {
    public:
        /// @brief 获取错误信息
        /// @param errorCode 错误码
        /// @return 
        static std::string getErrorMsg(int errorCode)
        {
            if (ERROR_MSG_MAP.find(errorCode) != ERROR_MSG_MAP.end())
            {
                return ERROR_MSG_MAP.at(errorCode);
            }
            else
            {
                return "未知错误";
            }
        }

    private:
        const static std::unordered_map<int, std::string> ERROR_MSG_MAP;
    };
}